package com.kfm.usermanagement.controller;

import com.kfm.usermanagement.model.Dept;
import com.kfm.usermanagement.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/dept")
public class DeptController {

    @Autowired
    private DeptService service;

    // 实际匹配的请求是 /dept/list
    @RequestMapping("/list")
    @ResponseBody
    public List<Dept> list() {
        return service.findAll();
    }

    @RequestMapping("/info")
    public String info() {
        return "info";
    }
}
